< previous page page_663 next page >

Page 663
Cascading occurs when users update or delete columns in one table that are referred to (via the relation object) by other columns in other tables. When this update or delete occurs, Microsoft Jet automatically updates or deletes all the records that are part of the defined relation. If you define a relationship between the column Valid.ListID and the column Master.ListID, for example, any time a user updates the value of Valid.ListID, Microsoft Jet scans the MasterTable and updates the values of all Master.ListID columns that match the updated values in the Valid.ListID column. In this way, as users change data in one table, all related tables are kept in sync through the use of cascading updates and deletes.
Building the Cascading Demo Project
The MULTIUSE.MDB database used in the earlier exercise is also used for this exercise. This database has a one-to-many relationship with enforced referential integrity for both cascading updates and cascading deletes. ValidTypes is the base table, and CustType is the base field. MasterTable is the foreign table, and CustType is the foreign field. You might find it helpful to open this database in the Visual Data Manager (Visdata) and explore the structure of these two tables.
Tip.gif
It might seem to you that the terms base table and foreign table are used incorrectly in the relation definition. It might help you to remember that all relation definitions are based on the values in the ValidTypes table. Also, it might help to remember that any data table related to the ValidTypes table is a foreign table.

Now you build a project that illustrates the process of cascading updates and deletes. Use the information in Table 17.1 and Figure 17.8 to build the MULTIUS3.VBP project.
Table 17.1. The control table for the MULTIUS3.VBP project.
ControlPropertySetting
FormNameCh1703
CaptionCascading Demo
Left1020
Height4275
Top1170
Width6480
DBGridNameDBGrid1

continues

 
< previous page page_663 next page >

If you like this book, buy it!